import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

import 'theme_resources.dart';

final ThemeColors _darkThemeColors = ThemeResources.dark.colors;
final ThemeColors _lightThemeColors = ThemeResources.light.colors;

/// 亮色主题
ThemeData themeDataLight = ThemeData(
  brightness: Brightness.light,

  /// 配置苹果组建的颜色主题
  cupertinoOverrideTheme: NoDefaultCupertinoThemeData(
    primaryColor: _lightThemeColors.primaryColor,
    applyThemeToAll: true,
  ),

  primaryColor: _lightThemeColors.primaryColor,

  /// 点击水波纹动画效果
  /// 这里我们把水波纹动画去掉
  splashFactory: NoSplash.splashFactory,
  highlightColor: Colors.white.withOpacity(0),
  splashColor: const Color.fromARGB(255, 145, 94, 94).withOpacity(0),
  textSelectionTheme: TextSelectionThemeData(
    cursorColor: _lightThemeColors.cursorColor,
  ),

  /// 设置AppBar主题
  appBarTheme: AppBarTheme(
    /// 配置AppBar背景颜色
    backgroundColor: _lightThemeColors.appBarBackgroundColor,

    /// 配置AppBar的图标主题
    iconTheme: IconThemeData(
      color: _lightThemeColors.appBarIconColor,
    ),

    /// 配置AppBar的标题样式
    titleTextStyle: TextStyle(
      fontSize: 17,
      color: _lightThemeColors.appBarTitleColor,
    ),
  ),

  /// 配置TabBar主题
  tabBarTheme: TabBarTheme(
    /// 配置TabBar的分割线颜色
    dividerColor: Colors.white.withOpacity(0),
  ),

  /// 配置颜色主题
  colorScheme: ColorScheme.light(
    /// 配置输入框 光标的颜色
    primary: _lightThemeColors.cursorColor,
  ),

  /// 配置Scaffold的背景颜色
  scaffoldBackgroundColor: _lightThemeColors.scaffoldBackgroundColor,
);

/// 暗黑主题
ThemeData themeDataDark = ThemeData(
  brightness: Brightness.dark,

  /// 配置苹果组建的颜色主题
  cupertinoOverrideTheme: NoDefaultCupertinoThemeData(
    primaryColor: _darkThemeColors.primaryColor,
    applyThemeToAll: true,
  ),

  /// 点击水波纹动画效果
  /// 这里我们把水波纹动画去掉
  splashFactory: NoSplash.splashFactory,
  highlightColor: Colors.white.withOpacity(0),
  splashColor: Colors.white.withOpacity(0),
  textSelectionTheme: TextSelectionThemeData(
    cursorColor: _darkThemeColors.cursorColor,
  ),

  /// 设置AppBar主题
  appBarTheme: AppBarTheme(
    /// 配置AppBar背景颜色
    backgroundColor: _darkThemeColors.appBarBackgroundColor,

    /// 配置AppBar的图标主题
    iconTheme: IconThemeData(
      color: _darkThemeColors.appBarIconColor,
    ),

    /// 配置AppBar的标题样式
    titleTextStyle: TextStyle(
      fontSize: 17,
      color: _darkThemeColors.appBarTitleColor,
    ),
  ),

  /// 配置TabBar主题
  tabBarTheme: TabBarTheme(
    /// 配置TabBar的分割线颜色
    dividerColor: Colors.white.withOpacity(0),
  ),

  /// 配置颜色主题
  colorScheme: ColorScheme.dark(
    /// 配置输入框 光标的颜色
    primary: _darkThemeColors.cursorColor,
  ),

  /// 配置Scaffold的背景颜色
  scaffoldBackgroundColor: _darkThemeColors.scaffoldBackgroundColor,
);
